#include "JsonArrayMM.hpp"
#include "JsonNodeMM.hpp"

JsonArrayMM::JsonArrayMM(JsonArray *array) {
  this->array = array;
  this->length = json_array_get_length(array);
}

unsigned JsonArrayMM::get_length() {
  return this->length;
}

JsonNodeMM *JsonArrayMM::operator[] (unsigned i) {
  if ( i > this->length ) return NULL;

  return new JsonNodeMM(json_array_get_element(this->array, i));
}

JsonNodeMM *JsonArrayMM::get_element(unsigned i) {
  if ( i > this->length ) return NULL;

  return new JsonNodeMM(json_array_get_element(this->array, i));
}
